package com.ny.demo02;

public class Employee {
    // 私有成员变量
    private String name;
    private int age;
    private String department;

    // 无参构造方法
    public Employee() {}

    // 有参构造方法
    public Employee(String name, int age, String department) {
        this.name = name;
        this.age = age;
        this.department = department;
    }

    // Getter 和 Setter 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    // 显示职工信息的方法
    public void displayInfo() {
        System.out.println("\n职工信息如下：");
        System.out.println("姓名：" + name);
        System.out.println("年龄：" + age);
        System.out.println("部门：" + department);
    }
}

